<!DOCTYPE html>
<html  lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    
    <title>shiro login</title>
    
</head>

<body>
	账号：<input type="text" name="username" /><br />
	密码：<input type="text" name="password" /><br />
	<input type="button" id="subbtn" value="登录" />
    
<!-- 全局js -->
<script src="static/js/jquery-1.9.1.min.js" ></script>
<script type="text/javascript">

	$(function(){
		$("#subbtn").click(function(){
			var username = $("input[name='username']").val();
			var password = $("input[name='password']").val();
			$.ajax({
			    type: "post",
			    url: "http://localhost:8080/login",
			    data: {
			        "username": username,
			        "password": password
			    },
			    success: function(data) {
			    	console.log(data)
			    	if(data.result == true){
				    	location.href = 'http://localhost:8080/index';
			    	}
			    },
			    error: function(){
			    	alert("error");
			    }
			});
		});
	});

</script>
</body>
</html>
